﻿using System;

namespace SmallDataBase.Attribute
{
    /// <summary>
    /// 表名属性
    /// </summary>
    [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
    public sealed class TableAttribute : System.Attribute
    {
        private readonly string _name;

        /// <summary>
        /// Table属性构造函数
        /// </summary>
        /// <param name="tableName">实体对应的数据库表名</param>
        /// <param name="dbName">数据库名称</param>
        public TableAttribute(string tableName, string dbName)
        {
            _name = tableName;
            DataBaseName = dbName;
        }

        /// <summary>
        /// 数据库表名
        /// </summary>
        public string TableName
        {
            get { return _name; }
        }

        /// <summary>
        /// 数据库名
        /// </summary>
        public string DataBaseName { get; set; }
    }
}